1. Field of the Invention
The present invention relates to a mobile agent, and in particular to processing performed when the mobile agent is moved from one computer to another.
2. Description of the Related Art
Conventional processing performed when a mobile agent is moved will be explained while referring to FIGS. 1 and 2. A computer A (1) is connected to a network 25, and a computer B (27) is also connected to the network 25. The computers A and B, which can be any type of computer, include one or more processors and a main memory and execute various programs. A storage device, such as a hard disk drive, is optional. Since the computer A (1) and the computer B (27) perform communication across the network 25, computer A (1) also includes a communication adapter and a communication module 23 that cooperates with the adapter and the computer B (27) also includes a communication adapter and a communication module 49 that cooperates with the adapter. The computer A (1) executes a program that provides an execution environment 3 (hereinafter referred to as an agent execution environment or simply as an execution environment) for a mobile agent. A mobile agent 5a includes a program A (7) and a program B (9), which are agent programs, and a state 11 of a program, and is activated in the agent execution environment 3. The agent programs 7, 9 define the activity of the agent 5a, and are machine code that is interpreted/executed by a processor, classes in an object-oriented programming system, or source programs that are translated and executed by an interpreter. The state 11 of a program is represented by variables used in a program, a stack frame, or the like.
As shown in FIG. 1, an agent program includes one or more programs, and each program constituting the agent program has a mechanism (a pointer) that is used to refer to corresponding program code. That is, as shown in FIG. 1, program codes that correspond to the program A (7) and the program B (9), constituting the agent Sa, are stored as program code A (15) and program code B (17) in a cache 13, which is provided in the agent execution environment 3. The program code for the agent that was moved is held in the cache 13 for a predetermined period of time, together with the program code for an agent under the management of the agent execution environment 3. In FIG. 1, for example, program code X (19) is code for the agent that was moved. The cache 13 is not necessarily provided in the main memory of the computer A (1); program code may be stored in another storage device in the computer A (1).
The agent execution environment 3 is a program that provides a required computer resource and a service for the activity of the mobile agent 5a, and that includes a control mechanism for controlling the generation, the halting and the movement of an agent, and that stores, as state information, a mobile agent and management information for it The execution environment 3 reads program code, which is the source of a program, converts it into the program and executes the obtained program. When the agent execution environment 3 executes the program code unchanged, the program and the program code may be the same. The agent execution environment 3 communicates via the communication module 23 with an execution environment in another computer that is connected to the network 25. The individual agent execution environments have names uniquely determined on the network 25, arid the communication modules can employ these names to specify an agent execution environment with which to communicate. An execution environment 29 in the computer B (27) corresponds to the execution environment 3. The communication module 49 in the computer B (27) also corresponds to the one in the computer A (1). It should be noted that in FIG. 1 only the components that are required for moving the agent 5a from the computer A (1) to the computer B (27) are shown.
An operation performed when the agent 5a moves from the computer A (1) to the computer B (27) will now be explained. When a request for a move is issued to the execution environment 3 by the agent 5a or an external entity, the execution environment 3 halts the execution of the agent 5a, and a bit sequence generation module 21 converts the state of the agent 5a and program code used by the agent 5a into a bit sequence for transmission (or a transmission bit sequence). A move destination is included in the movement request. Since the state 11 of the program depends on the program code, during reproduction of the execution state, first the program code should be read and re-constructed in the execution environment 29, then the state 11 should be read and re-constructed. Therefore, during the transfer of a bit sequence, generally, as shown in FIG. 2, a bit sequence for the program code is transferred first and the bit sequence for the state 11 of the program is transferred last.
A transmission bit sequence (FIG. 2), which is generated by the bit sequence generation module 21, is transmitted to the communication module 49 in the computer B (27), which provides the bit sequence to the execution environment 29 at the destination computer B (27). The communication module 49 transmits the received bit sequence to an agent restoring module 39. The agent restoring module 39 regenerates the program code to obtain a program A (33) and a program B (35) for the agent 5b. Further, a bit sequence related to the received state 11 is re-built in accordance with the generated program A and the program B to provide a state 37 for the agent 5b. As a result, the agent restoring module 39 reactivates the agent 5b in the execution environment 29. The program code A (43) and program code B (45) are also provided to and stored in the cache 41, and respectively correspond to the program A (33) and the program B (35) in the agent 5b. In addition, program code Y (47) is held in the cache 41.
In a conventional agent moving operation, the agent cannot be reactivated by a destination computer until after all the bit sequences have been received from a source computer. Thus, the agent moving operation requires an extended period of time.
One method for transferring information is a cache technique whereby previously received program code is held, and when program code having the same name is present, it is re-used to improve the efficiency. However, (1) a version may differ even though the program code has the same name, and whether or not it is a desired program code cannot be determined; and (2) normally, a requesting source cannot in advance acquire accurate information as to which cache is present at a transfer destination. Therefore, it is difficult to determine which program code should be transferred.
A mobile agent is described in detail in U.S. Pat. No. 5,603,031. In this patent document, a technique is described whereby a digest is transmitted as an object for an agent that was exchanged once, and the object itself is not transferred. It is, however, not clear how long the identity of the object can be preserved, even though it is one of the agents that were once exchanged. If the identity is maintained, additional effort is required.